package cz.muni.fi.pa165.dao;

import cz.muni.fi.pa165.entity.Months;
import cz.muni.fi.pa165.entity.Mushroom;
import cz.muni.fi.pa165.entity.MushroomType;
import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author tuhar
 */
@Local
public interface MushroomDaoLocal {

    /**
     * Stores given mushroom in DB
     * 
     * @param mushroom mushroom to store
     * 
     * @throws IllegalArgumentException if mushroom is null,name of mushroom is null
     * or is not unique
     */
    public void createMushroom(Mushroom mushroom);
    /**
     * Retrieves mushroom with given ID from database
     * 
     * @param id id of mushroom we want to retrieve
     * @return mushroom with given id in database or null if not in DB
     * 
     * @throws IllegalArgumentException if id is null or is null
     */
    public Mushroom getMushroom(Long id);
    /**
     * Updates attributes of given mushroom in DB
     * 
     * @param mushroom mushroom with updated attributes
     * 
     * @throws IllegalArgumentException if given mushroom is null, id is null or name is null
     * or not unique
     */
    public void updateMushroom(Mushroom mushroom);
    /**
     * Removes given mushroom from database
     * 
     * @param mushroom mushroom, that will be removed from DB
     * 
     * @throws IllegalArgumentException if given mushroom is null or id is null
     */
    public void removeMushroom(Mushroom mushroom);
    /**
     * Returns all mushrooms that are in DB
     * 
     * @return all mushrooms stored in DB
     */
    public List<Mushroom> findAllMushrooms();
    /**
     * Returns mushroom from DB with given name
     * 
     * @param name name of mushroom, we want return
     * @return mushroom with given name
     * 
     * @throws IllegalArgumentException if name is null
     */
    public Mushroom findMushroomsByName(String name);
    /**
     * Returns all mushrooms with given type
     * 
     * @param type type of mushrooms, we want return
     * @return mushrooms with given type
     * 
     * @throws IllegalArgumentException if type is null
     */
    public List<Mushroom> findMushroomsByType(MushroomType type);
    /**
     * Returns all mushrooms which grow in given period. 
     * Period of returned mushrooms starts before or exactly on month of start
     * of given period and ends after or exactly on month of end of given period
     * 
     * @param from Start of period
     * @param to End of period
     * @return mushrooms that grow in given period
     * 
     * @throws IllegalArgumentException if month to is before month from or 
     * one of them is null
     */
    public List<Mushroom> findMushroomsByOccurence(Months from, Months to);
}
